#include<iostream>
#include<cstring>
using namespace std;
const int maxn = 20005;
int x,n,m;
int fa[maxn];

int findf(int x)
{
    return fa[x] == x ? x : fa[x] = findf(fa[x]);
}

bool join(const int &u, const int &v)
{
    int f1 = findf(u), f2 = findf(v);
    if (f1 == f2) return false;
    else { fa[f2] = f1; return true; }
}


int main(){
	cin>>x>>n>>m;
	int a,b;
	for(int i=1;i<=x;i++)fa[i]=i;
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		join(a,b);
	}
	for(int i=1;i<=m;i++){
		cin>>a>>b;
		if(findf(a)==findf(b))cout<<"Yes"<<endl;
		else cout<<"No"<<endl;	
	}
	return 0;
}
